import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/pages/index'
import Login from '@/pages/login'
import reg from '@/pages/reg'
import Details from '@/pages/details'
import Balance from '@/pages/balance'
import pay from '@/pages/pay'
import order from '@/pages/order'
import orderDetail from '@/pages/order/detail'
Vue.use(Router)
Router.prototype.openPage = function (link, query) {
  const meta = this.currentRoute.meta;
  meta.time = new Date().getTime();
  this.push({
    path: link,
    query,
    meta
  });
};
export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index,
      meta: {
        isHeader: true,
        isLogin: false
      }
    },
    {
      path: '/Login',
      name: 'Login',
      component: Login,
      meta: {
        isHeader: false,
        isLogin: false
      }
    },
    {
      path: '/reg',
      name: 'reg',
      component: reg,
      meta: {
        isHeader: false,
        isLogin: false
      }
    },
    {
      path: '/Details',
      name: 'Details',
      component: Details,
      meta: {
        isHeader: true,
        isLogin: false
      }
    },
    {
      path: '/Balance',
      name: 'Balance',
      component: Balance,
      meta: {
        isHeader: true,
        isLogin: true
      }
    }, {
      path: '/pay',
      name: 'pay',
      component: pay,
      meta: {
        isHeader: true,
        isLogin: true
      }
    }, {
      path: '/order',
      name: 'order',
      component: order,
      meta: {
        isHeader: true,
        isLogin: true
      }
    }, {
      path: '/orderDetail',
      name: 'orderDetail',
      component: orderDetail,
      meta: {
        isHeader: true,
        isLogin: true
      }
    }
  ]
})
